<template>
  <div>
    <h4 class="text-center">参加的志愿活动</h4>
    <table class="table ">
      <thead class="thead-dark">
        <tr>
          <th>活动名称</th>
          <th>活动类别</th>
          <th>活动参与时间</th>
          <th>活动完成情况</th>
          <th>活动详情</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        <tr :key="item.index" v-for="item in VACollection" :class="item.isComplete?'table-success':'table-warning'">
          <td>{{ item.activityName }} </td>
          <td>{{ item.activityTypeName }}</td>
          <td>{{ item.activityJoinTime }}</td>
          <td>{{ item.isComplete?"完成":"待完成" }}</td>
          <td><router-link :to="'/home/MyVoluntary/Show/'+item.activityID">详情</router-link></td>
          <td><router-link :to="'/home/MyVoluntary/Comment/'+item.relationID">分享评论</router-link></td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script>
export default {
  name: 'MyVoluntary',
  data() {
    return {
      VACollection: null
    }
  },
  created() {    
    let voluntaryID=JSON.parse(localStorage.getItem('Person')).voluntaryID
    //向后端发起数据然后返回
    this.axios.get(`/SelectIdentity/Voluntary/GetMyVoluntaryByVoluntaryID?VoluntaryID=${voluntaryID}`).then(res=>{
      if(res.data!=null){
        this.VACollection=res.data
      }
    })
  }
}
</script>

<style lang="less" scoped>
</style>
